<template>
  <div class="person-mv">
    <h3 class="person-header">
      <router-link to="/home/newmv">{{title}}<i class="iconfont icon-youjiantou"></i></router-link>
    </h3>
    <ul class="mvParent">
      <li v-for="(item,index) in personalMv" :key="index" @click="mvDetail(item)">
        <div class="playcount" v-if="item.playCount">
          <i class="iconfont icon-bofang"></i>
          <span class="count">{{item.playCount}}</span>
        </div>
        <i class="iconfont icon-sanjiaoright
" v-else></i>
        <img :src="item.picUrl" alt="">
        <span class="copywriter">{{item.copywriter}}</span>
        <p class="author">{{item.artistName}}</p>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'PersonalMv',
  props: {
    title: String,
    personalMv: {
      type: Array,
      default() {
        return []
      }
    }
  },
  methods: {
    mvDetail(item) {
      // 获取mv详情数据   然后跳转到详情路由
      this.$store.dispatch('getMvDetail', item.id)
      this.$router.push(`/home/mvdetail/${item.id}`)
      console.log(item.id)
    }
  }
}
</script>

<style lang="less" scoped>
.person-mv {
  .person-header a {
    display: flex;
    align-items: center;
    margin-left: 20px;
  }
  .mvParent {
    display: flex;
    justify-content: space-between;
    padding: 0;
    width: 100%;
    li {
      position: relative;
      width: 33.33%;
      margin: 0 20px;
      border-radius: 8px;
      overflow: hidden;
      .icon-sanjiaoright {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 20px;
        height: 20px;
        background-color: #fff;
        border-radius: 50%;
        &::before {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
        }
      }
      .playcount {
        position: absolute;
        top: 0;
        width: 100%;
        color: #fff;
        height: 25px;
        line-height: 25px;
        background: rgba(0, 0, 0, 0.4);
        text-align: right;
        i {
          margin-right: 3px;
          vertical-align: top;
        }
        .count {
          margin-right: 10px;
          font-size: 14px;
        }
      }
      img {
        width: 100%;
        height: 250px;
        border-radius: 8px;
      }
      .copywriter {
        display: inline-block;
        width: 320px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 14px;
        padding: 8px 0;
      }
      .author {
        font-style: italic;
      }
    }
  }
}
</style>